package org.traffometer.packet;

import java.util.Date;

import org.traffometer.packet.location.Location;

/**
 * Implements a representation that contains a location and timestamp. The TraffoPacket 
 * object will contain a two location-timestamp pairs to represent the start and end points 
 * of a vehicles travel.
 *
 * @author Aaron A. Kagawa
 * @version $Id$
 */
public class LocationTimestampPair {

  private Location location;
  private Date timestamp;
  
  /**
   * Constructs a location-timestamp pair. All parameters must not be null.
   * @param location The location associated with the pair.
   * @param timestamp The timestamp associated with the pair.
   */
  public LocationTimestampPair(Location location, Date timestamp) {
    this.location = location;
    this.timestamp = timestamp;
  }
  
  /**
   * Returns the location associated with this LocationTimestampPair.
   * @return The location.
   */
  public Location getLocation() {
    return this.location;
  }
  
  /**
   * Returns the timestamp associated with this LocationTimestampPair.
   * @return The timestamp.
   */
  public Date getTimestamp() {
    return this.timestamp;
  }
  
  /** 
   * {@inheritDoc}.
   * The toString will have the following format:
   * L1, T1  
   */
  public String toString() {
    return this.location.toString() + ", " + this.timestamp.toString();
  }
}